﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Platform.Model.Repositories
{
    public class EmployeeRepository
    {
        /// <summary>
        /// Lấy danh sách Nhân viên sắp xếp tăng theo LastName, nếu trùng sắp xếp tăng theo FirstName
        /// </summary>
        /// <returns>Trả về danh sách Nhân Viên</returns>
        public static List<Employee> Employee_List()
        {
            return Employee.Objects.GetAll().OrderBy(x => x.LastName).ThenBy(x=>x.FirstName).ToList();
        }

        /// <summary>
        /// Thêm nhân viên
        /// </summary>
        public static int Employee_Insert(Employee e)
        {
            return Employee.Objects.Insert(e);
        }

        /// <summary>
        /// Xóa nhân viên
        /// </summary>
        public static void Employee_DeleteById(int Id)
        {
            Employee.Objects.DeleteByKey(Id);
        }
    }
}
